<?php

App::uses('AppModel', 'Model');

/**
 * Chapter Model
 *
 * @property Event $Event
 * @property Place $Place
 */
class Chapter extends AppModel {

    /**
     * Display field
     *
     * @var string
     */
    public $displayField = 'name';

    //The Associations below have been created with all possible keys, those that are not needed can be removed

    /**
     * hasMany associations
     *
     * @var array
     */
    public $hasMany = array(
        'Event' => array(
            'className' => 'Event',
            'foreignKey' => 'chapter_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        ),
        'Place' => array(
            'className' => 'Place',
            'foreignKey' => 'chapter_id',
            'dependent' => false,
            'conditions' => '',
            'fields' => '',
            'order' => '',
            'limit' => '',
            'offset' => '',
            'exclusive' => '',
            'finderQuery' => '',
            'counterQuery' => ''
        )
    );
    public $validate = array(
        'name' => array(
            'rule' => 'notEmpty',
            'message' => 'This field cannot be left blank'
        ),
        'desc' => array(
            'rule' => 'notEmpty',
            'message' => 'This field cannot be left blank'
        ),
        'url' => array(
            'rule' => 'url',
            'message'   => 'it must be valid URL',
            'allowEmpty'    => true
        )
    );

}
